     {  Petrova Tatjana
     2012 / 09 / 25
     This program can write you the destination. }

program Destination;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  x0,y0,x1,y1,x2,y2,a,b,c : integer;
  d,xp,yp,c2,c1:real;
begin
  readln(x0,y0);
  readln(x1,y1);
  readln(x2,y2);
  a:= y1-y2;
  b:=x2-x1;
  c:=x1*y2-x2*y1;
  d:=(a*x0+b*y0+c)/sqrt(a*a+b*b);
  xp:=x0-(a*d/sqrt(a*a+b*b));
  yp:=y0-(b*d/sqrt(a*a+b*b));
  if((xp-x1)*(xp-x2)<=0)  and ((yp-y1)*(yp-y2)<=0)then
  begin
    writeln(d);
    readln;
    exit;
  end else
  begin
    c2:=sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
    c1:=sqrt((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2));
    if(c2>c1)then
      writeln(c1)
    else
      writeln(c2);
  end;
  readln;
end.
     
